package com.sisy.dubbo_provider;

import com.sisy.common.RefundOrder;
import com.sisy.common.RefundOrderService;
import com.sisy.mapper.RefundOrderMapper;
import io.seata.core.context.RootContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * @author: xx
 * @date: 2021-02-04 11:21
 */
@Component
public class RefundOrderServiceImpl implements RefundOrderService {
    @Autowired
    private RefundOrderMapper refundOrderMapper;
    @Override
    public int updateRefundOrder(Integer id, BigDecimal refundAmount) {
        System.out.println(" -=-=-=-=- 全局事务id ：" + RootContext.getXID());
        int result = refundOrderMapper.updateRefundOrder(id, refundAmount);
        return result;
    }

    @Override
    public RefundOrder getRefundOrderById(int id) {
        return refundOrderMapper.selectRefundOrderForUpdate(id);
    }
}
